changed typeof check to instanceof
Merge pull request #115 from atdrago/master

changed typeof check to instanceof