Fixing bug in database schema