Fixes to database tools