fixed the get_document function to better work with file objects by using the .name attr.