Fixing possible code errors from Visual Studio 2013 Code Analysis run