Fix issues causing clang warnings

and an actual bug (a tautology in an if condition) in TH3