put a guard against out of bounds accessing of the Map::cells array