fix some js errors