Diver, there is an excellent Nikon users website called Nikonians, which has a forum specifically for Nikon D40 and D50 cameras; there is a thread on all known fully-compatible lenses for the series, and a 50mm f 1.8 is not among them. I suspect a combination of factors is at work here and the result is that you are getting purple fringing or chromatic aberration as Steve says, possibly by a combination of the incompatible lens' aperture staying at f1.8 rather than stopping down sufficiently to give any depth of field plus the use of the close-up diopter attachment. The lens also could be faulty, with one or more elements knocked out of alignment. You might post a query on that website to see if anyone has experience with your particular camera/lens combination. Sorry you're having such difficulty.