String substitution fixes