Improve coverage

* Some tests fixed and some new added.
* Optional parameters that can actually never be omitted became mandatory.
* Exceptions that check consistency inside modules replaced with asserts.