Tweaked a few things and added fallback for wp version<=3.4 media uploader