Fix deadlock on OS x