Fix issues from SCA and Coverity