bugfix in documents.py