added liscence file and fixed a serious js bug