check if resource exists before loading it