Merge pull request #1676 from Yann-lms/static_analysis

Correct some issues found with static analysis tools