some js errors and coding conventions