Fixed the media functions in js