Mega r3 retaining info

Sounds like a bad connection on the DIRECTION pin of the stepper driver. Is the X-axis stepper the only one acting up? Does it change if you swap the X and Y stepper drivers?