Fix code due to API changes