Fix chunk handling