Various warning fixes

Fixes few warnings emitted when compiling with Wextra and pedantic flags.