fixed major bug with pathfinding