fix old code with new API.