Fix editing bugs