Adapt to API changes, fix compilation.