Fixed a logic error while loading maps