Fixes resulting from code analysis