foreach meta data optimization