Fix bug: can query just by reference