updated to work with ape 3.1-2