Bug fixes to correct equal checking.