Fixing the JS error