fix for bidirectional relation query