moved some code from init_machine to init_early