Fixed issue #784, that leads to a maladjusted exception. Reported by David Jorm.