Fixed coverity issues: 1164785, 1164787, 1164788, 1164790-1164794