Fixed bug in sparse_grid_build