helper: consider the real buffer size