javascript errors fixes