fixed issue when reading from stdin