Fixing JS problems