fixed wantarray return for put_doc and put_file, also added test for it