Fixed #1339 for maps.
Fixed #1339 for documents.
Merge pull request #1351 from capooti/issue-1339

This fixex #1339