Fixed coverity issues

(cherry picked from commit 4ba3aae2ea0290ca012623083e13625e08a9dde5)