Fix for javascript errors while page is loading.