fix cannot load database after the first time user exit the application