don't use separate chunk size counter, use Array.length instead