fixing a bug in the documents controller