fix locking in segbuf