fix search $ref bug