when doing large numbers of steps - especially the case with 1/32 micro stepping - the steps variable is unable to correctly store the number due to integer overflow. This results in the motor moving in the opposite direction.
Could the type of the variable steps be changed from int to long to give it a much larger range of steps that it can accept?