Thanks but it's not the wiring the way my 3d printer is setup is i don't have a Z endstop switch i have the sensor in place of where the Z endstop switch is suppose to be plugged in because the manual say i can do so, but anyway back to the issue i was having where it doesn't come back up to auto level what i did was i change #define INVERT_Z_DIR to true now it's working like a charm again.

If you are a person who gets upset easily when working on things do not buy a 3d printer because you might throw it out of a window or or throw it at your flat screen tv, WOW finally it's working like it should again, WOW.