improvement to avoid a lot of redundant image loading