added undefined error (since nan is not descriptive and should always be an error)