Fix Stream.resource code