fix image gallery bug