Add on_proc hook called in lib mode only