patch for change iteration order