fix bugs for editing