Fixing JS error