Fixed some more warnings.

This is in progress, not completed. But please comment on what's been done so far.

Some of the fixes are rather ugly, but they all work.

Also, the warning I tried to fix with my previous PR is still not fixed, it might actually need a cast.
Spaces missing.