Coverity scan fixes

Correct some defects highlighted by Coverity Scan. These fixes, however, won't affect the performance of OC.