Fixed a lot of warnings for possible problems.

21 files changed