Fixed uppercase warning detection

Corrected scope of var i, and made the error output red.