Fix JS exceptions