Fixed a problem with database states during tests