merge in David's comments and proper Coverity Scan fixes