Add clean up function to deal with broken uploads.