John and vicious1,
Sure the endstops need to be properly set up in the firmware but can we all agree that there is at least a second problem here? One symptom is that the X max motor is operating differently than the Y min motor. The X max motor cannot operate differently than the X min unless there is one of a few problems: intermittent wiring, a bad intermittent X max motor, or possibly marginal stepper driver current that the X min and X max motors respond to differently (I think a long shot). Agreed?
Greg’s suggestions are spot on. Also you could swap X and Y everything.