fix image upload (not fully tested...)