Fix for buffer size check