added fixed resource loading bugs