fixing javascript syntax