Fixed bug with toString being taken from the global scope.