separate File.open and puts to fix image failure