fixes variable substitution