You shouldn't call `InvariantCheck()` at all if `invset == "0"`.

It's usually best to write short conditional assignments on one line; then you avoid this problem:

`bool invCheck = (invset == "0" ? true : InvariantCheck());`