manual merge of PR #785