Fixed coverity issues