bug fix, small misordered varibles and generic vars