add assertions to make debugging easier