Fixed the bug of changing keys for direction