Added JS exception handler