Properly mark modules that failed to load as not loaded. Removed unused functions