seems that somebody was checking output file descriptor and not input file descriptor