fixed direction change bug