fix staging buffer alloc algorithm. return the next available block instead of the block after the next available block. off by one?

put the char lookahead in global. we need tp preserve the lookahead so the next call to next char not skip the unhandled lookahead