implement part of convert()