Added fix for race condition which leads to channels blocking on write due to zero length.
Merge branch 'race_fix'