fix racyness of iopub handling