fix defects found by coverity scan