Some database fixes