moved chunk_length to length