Fixes to issues identified by Coverity.

talked to @esiragusa keeping this