buffer read logick added