Some small fixes for errors caught in static analysis.