add failcount to buildrepo nextbuild output, and fix a query error.