Fixes to db