Simplify logic in multiple places
Simplify logic in multiple places

In particular, do not use assert when an if suffices.

szilvajuhos/CAW,marcelm/CAW,marcelm/CAW,marcelm/CAW,szilvajuhos/CAW,szilvajuhos/CAW