- Fixed bugs, adapted to latest API.