This hopefully fixes the infinite loop bug in finding the open area