Fixed the controller function for media