fix for variant when program read input and write output simultaneously (there was deadlock with output buffer)