The keyForceTimer at the lines 73-103 is responsible for the direction forces. It seems that the object check on line 78 is causing the problem.