fix validation on buffer