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