call after immediately when entering main event loop function