synced from master of codeplex