Adapted to state API changes.