fixed bug for javascript errors