added a few checks to prevent segfaults in maped when failing to load or create maps