script loading at end to fix error