Fix a bug where we could return too much data from the byte source. Add test.