Fixed bad variable substitution