fix image saving