set correct stack size after AutoDiff