Scripts are now applied correctly when refreshing the page