fix race condition segfault when attaching a sink