Small fixes to database