fix documents page query
remove some unused code
fix modals on documents page