handle nested foreach
build dist