Fix setResource bug and remove loadScript, loadJson