optimizations to loading strategy and fixes for latest mime gem