fixing page loading for separate head/foot js