Parial fix for issue #8677: exclude early exit in equals() for Mod
Merge pull request #8687 from skirpichev/8677-fix1

Parial fix for issue #8677: exclude early exit in equals() for Mod