Made compatible with recent API changes.