add applySpre, applySpost; fix some type errors; comment out some code