adjusted for recent API changes