initial version with deadlock while reading from a channel