Fixed some db stuff