Bug fixes for undamped Newton iteration. Added a test as well.