Fix variable substitution