fix image gallery loading flicker