fixed js errors with socket