Fixed D(func) and small fix.