Minor fixes to AD integration