fixing some bugs with edit