correcting end stop check