Improve asserts in perpetual_generator