fix styles and scripts to only load when necessary