fixing javascript errors