Fixes to issues identified by Coverity.

talked to @esiragusa removing this again