Move invalid JS in layout