Fixed a bug to detect more equal states