fix condition for stdin and allow piping to stdout