fix error when uploading an exitsing document