some db bugfixes