Fixed some javascript related problems