fix a bug in convert()