Fixing javascript problem