Fixes from code analysis