Fixing js errors