add hook for BufWrite event