diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index 4b758a61b62beb32f27de9da6037a368f07c1c89..0ab5886799a2db0d541241b03493179b46c7888d 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -778,8 +778,8 @@ static int __build_step(const char *what, const char *name, const char *filename
 				*label = NULL;
 				/* Remember where the whileblock starts */
 				forblock = (*pos);
-				build_step("for", margs, filename, lineno, con, exten, pos, fields->next->next->data, &fillin, label);
 				build_step("for", margs, filename, lineno, con, exten, pos, c, &fillin, label);
+				build_step("for", margs, filename, lineno, con, exten, pos, fields->next->next->data, &fillin, label);
 				/* Close the loop */
 				app = "Goto";
 				snprintf(margs, mlen, "%d", forstart);