made user script more robust, and trace events making leave the page