Fixed bug in producer-consumer implementation.