Fixes for database