fixed a cast bug in map_group::add_layer