fixed visitReferenceTree