Fixed some problems reported by cpplint.py, changed foreach to for in files touched by me