stricter checks for buffer underruns while advancing the offset
some tests and better debug messages