Fixed coverity defects

fixed defects reported by coverity