fix crash bug when used with AR::Relation trace