made MemWStream val typed again, if you want refernace pass a pointer