Code fixes

Various code fixes, mostly discovered by MSVC code static analyzer .
So why is index+col referenced in the if() ?  Which could also overflow, no?