Fix errors found by Coverity
Merge branch 'master' into DirListingOptimization