Fixing problem in addmedia script