Numerical gradient check fix