Error message and buffer bounds cleanups