Added extra activationfn/errfn error checking.