Code: Fixes minor problems

Fix some problems reported by the Coverity scan tool