Fixed error when rotating to negative directions.