Fixing coverity reported warnings