Corrected errors when updating docrels (refs #4240)

Backport from 3.2:
- #3073
- #3404
- #4235
Version 3.1.11
Merge pull request #983 from eguaj/3.1-A4240

Corrected errors when updating docrels (closes #4240)