fixup bug in matching logic for custom classes

Fixes #32
Merge pull request #43 from zxqfox/hotfix/invalid-match-logic-on-classes

fixup bug in matching logic for custom classes