Rework buffer counting for Hackfest compatibility

Change-Id: I02749c7fc2ccaaa8e50d11dbb8b07a8b5104f290