Cover all of the API and admin pages in the unit tests and fixed some bugs.