This should not have been deleted in the first place. See comments on #1068.
Merge pull request #1089 from afred/restore-if-document-1068

This should not have been deleted in the first place.