Clang warnings

Clang 3.2 reveals some more warnings than gcc. This patch fixes most of them.