fix some JS errors