use 2 streams (input and output) instead of 1 in parse_from_memory()