Final database fixes