fix #50 grid nesting

Fix with what I proposed on the issue #50 regarding the nested grids.