Small improvement to end-of-chunk check