Fixed database update bug