Fix and reorder <script> tags