fixing Coverity defects 16118 and 15959