Fixed issue about reverse processing of the loops