safer code for h_grads