make safe for binary data

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

make safe for binary data