Fixing seg fault bug because of the map status