Modified so that pre_init is called when service/server is started.