Fix debug queries