Corrected bufffer clearing index limit