change detecting rules and add test
Merge pull request #306 from mimmi20/issue-304

Fixes #304