Changed order of index return in asyncforeach to be the last param