fixed defects found by coverity scan