Refactor test database access into [model].count.
Remove the last sql statements from the tests; Also fix a bug with loading skills.