fixing hashgrid calculation