bug fixes for document upload