Fixes an issue with wrong buffer length

Fixes #61