Changed typeof to Object.prototype.toString.call - fixes #6.