Change how we handle bad requests. Increment bad requests whenever we
do a restart.
Add unit tests and fix up stat code for the tests.