fix bug in Database