Adapt to latest ctrulib changes. Other misc shiz.