Fixed database bug