See here on how to adjust focus.
http://astrosurf.com/buil/autofocus/adjust.htm
The 50mm F1.8 is difficult even with trial and error. Put a sticky label on the barrel and focus ring with marks to get focus. I have a stepper motor and dead printer belt to control focus and it is the only thing that works for me.
Bert