fix an example and enhance stdin