Fixed some code analysis bugs