Small misc fixes
Some static analysis fixes via Coverity Scan