implement map_size function