enhance stdin, see #1403