added debug code to resource loading