This should fix issue #166, not unit-testable