Fix a serious logic flaw in the conversion script.