Page not loading properly

not sure that this is the cause, but I believe that the best practice is to put the script in the “Before” section of the custom code…

see if that will help you