Fixes #368

Avoids the false positives listed in #368 and passes all tests.