Fix JavaScript issues