fixing javascript error