Revert "Merge pull request #1846 from alex55i/nan"

This reverts commit 59e51de270bc0771a8e18b064a8def86a12d6740, reversing
changes made to a45659dbc88913acd6ccc1816eaf4bbba17e4dbb.