[Fixes 1540] changed contract.assert to debug.assert

Totally unrelated to your PR, but this is super hard to read.