Fixed compilation issue when template had more than one for loop