Fix chunking performance problem