Fixed bug in copy_grid().

It was still assuming that there's only one z-level of grids in map.