Added check for NaNs in acceptance for CustomIntegrator minimizer.
Updated minimizer to eliminate NaNs in case where gradient norm is zero.