Fix compiler & analyzer warnings