Fix some bugs related to player attack and movement