tweaked upload handling to stop unit test from hanging