fix some db issues