newton method and fixes