Fix bug DNN-5129: store settings into private variable so that it can be used in for-each.