fixed a bug for resource loading