fixing JS error