Fix media upload crashs on python3

Should fix #257, #265 & #269, please check @sixohsix @alepg @simmons449 @ok1rig