fixed js errors on load