Rough Cookie fixes (notably an initialization race condition, C# stack trace handling, android target API level)

As discussed, some changes for review. I doubt you want to take these wholesale; sorry the commits are not better split up. But this at least gives you an overview of the changes we had to make to get up and running.