call undefine() after ontask() hook