Fixed another batch of compilation warnings.

I tried to do only the "obvious" warnings. See commit messages for explanations.