small code improvements in convert.cpp