Newton method checks for NANs and INFs.

It returns 'None' if 'd' has any INFs or NANs. Just improving
robustness.