bugfix for state compare function.