Fix var type inference2

Giving it another try.
this should not be necessary. ReplaceChildren sets the sort