fixing javascript sample