Fixes for Coverity issues: 21876, 21795, 21786, 21782, 21781