Fix references to undefined

See this article for explanation: http://tinyurl.com/bfft3dh