Added malformed media handling to enqueue script