Fixes #1858, also for maps and documents
Merge pull request #1875 from capooti/issue-1858

Fixes #1858, also for maps and documents