fix bug when mongodb can't connect