fix image-related encoding issues