fix init bugs in Main