query/1 and better debug logs