lose a few unnecessary asInstanceOfs