apply lesson learned from sh-buffer