bug fix in convert, cleanup