before kernelising derivs func