fixed some javascript errors