Fixes Visual Studio 2008 issues and thread issues