make safe for binary data

This fixes a bug where binary data would be corrupted.
Merge pull request #5 from tidepool-org/bewest/binary-safe

make safe for binary data