Revert "lose a few unnecessary asInstanceOfs"

This reverts commit 7921842e055e14f51f90dc4489be897dcf9ae8be.