fix a race condition during attach_ports
v0.2.1