Fixing some Code Analysis Errors