BUGFIX:
- owing to the late hour, missing include and constant typo (NAN != nan)