Fix for new database structure