writing data when given raw data buffer

The buffer is handled as it should afterward. Code was just lacking an if statement to handle it.

I have not tested it fully yet. It works in my use case as explained in issue #7 but I can't guarantee it's failsafe.