nan needs to be called first.