Fix unsatisfiability check

It used to miss some cases (for example, when there were two
vertices left, but they were already connected to each other)