fix calculation of number of moves