Fix two JavaScript issues