Fix race condition in the controller IO.
Fix initialization order.