Fixed a very large bug in the navmesh generation and added debugging logs for any similar bug in the future.