fix to change rotate direction with side distance