Fix a bug in documents API processing
Merge branch 'dev'