Optimizations in image loader logic.