compilation fixes and warning reductions

One compilation fix for GCC/clang and some other minor cleanups to reduce compiler warnings.