Another fix for windows crash with FOREACH_PARAM

It was still accessing an element beyond the end of the vector which could crash in some other cases.