Fixed some javascript errors