Fixing javascript issue