fixing variable issue in convert