Revert "remove assert checks"

This reverts commit 7020c0be9c676c297c38f5035fa503aeb38f0486.