Fixed issues revealed by the static analyzer.