Fix bug where puting cursor outside dungeon would cause an error