Bug fixes/improvements in "Calculate grids"