Fixing buffer size tracking