Fix exceptions in querypurger