added underbuffer protection