Code

Fixed some issues identified by static code analysis.