Fixed bug in agent on_init order.