remainchunk.slice() in metadata now uses correct end index