some db connection fixes