use Object.toString() instead of window.toString() in all calls to prevent IE errors, refs #214