Zero length pbf

Adds test and fix for zero-length buffer handling in backend.