added uninvert logic with code from oclint