fix Javascript end of input