use exceptions instead of $trigger_errors
Fix javascript for newest jquery