fix up variable ordering