Fix for warning messages logging to the console as 'undefined'

My first pull request, hope this works. :)