Clang fixes

Fixes several warnings and a couple of errors.