js bug fix

edit function