Fixed IO ordering issue