Fixed tests for empty database.
Fixed tests when run against empty database.