added window.onerror handler