fix bug in code sample for Stream.resource