Fixing deadlocked chan