improved multiple env merging