better sanity check for buffer sizing
debugging notes