fixed defects from coverity.com