fix variable substitution