SWC-1436: fix chunk calculation