Fix query + debug