Core/Misc: Fixed some of the Coverity defects