Fixed some convert foreach to for action bugs.