resource loading fixes/code cleanup