Fixes from static analysis
Minor changes

Pending changes on Randy.