for_each fix for linux mac and windows