Improve string memory management when receiving data.
Merge pull request #10 from handl/master

Improve string handling when receiving data