Exception handling vorrected for .NET 4.0