Core/Misc: Solved some issues found by static code analysis.