fix loader function