Added chunk length guard