fix bugs for env&db init and scheduler