fix: wrong order in substitution

should fix trac 657