Use Object.prototype.toString instead of window.toString due to IE issues