fix a bug with edit due to id increment