Fix cyclic-index bug in TddpHelperFunctions