fix bug when db empty.