fixed defects found by Coverity Scan