Fixed a logic error in the loader