Replaced gsub with grepl in .parse.deriv function