fix first time db not connected bug