fixing javascript earrors