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