fixed bugs with edit;