Fix some javascript errors