Fix hidden exceptions in combination with 'with'.