fix bug for arrange variables