Fix chunk size calculation (prevent byte offset data loss)