Fix exception caused by inline JavaScript