Adopt to new apis.