fix some bugs in edit.js