Fixed incorrect variable substitution