tk: added check on dK_dtheta for optimizer