fixed the edit state issue