More fixes to database