fixed some issues with pathfinding