copying memory stream
fixes