check if loader exists before throwing an exception