Fixed the output of scripts in the header/footer