added stdout.flush() after upload info