fixing some javascript problems