Fixed issue #58 - previously not all substitute alternatives were tried.
Added issue 58 tests.