fix bad variable substitution