Port JS bugfix for media manager from the CMS