Some fixes from SCA runs

I've submitted these patches already to the upstream repository maintainer, but didn't get a reply so far.