Add debugging to determine when uploading is complete