Fix query path builder