fixed problem about related predicates that occurred on nested substitutions