fixed various js errors