put in another safety check for pathfinding