fix SEGV on iterating function definitions