Fix issue #771. Fix issue #769.