Fix db issue in main