Fixed to_pointer conversion with namesapce for related_to queries