better piped input detection