some fixes to media upload