fixup bug in matching logic for custom classes

Fixes #32