fix bug in database