fixing javascript errors caused by non-origin