fix multiple variable substitution