Fix a few compilation warnings

Unused, bad comparisons, etc.