fixed move distance function for both directions