Fix crash on creating map with invalid mg_name