make sure buffer is completely sent