fixing javascript problems