improved ConvertWord and ported to mlton