Bug fixes for media upload