Replace if-then-else by assert as suggested.