Added extra check to parsing substitution