fix middle<->medium var name bug