bugfix, delete the sid if it's values is empty

* regenerate sid, if the old key doesn't exists, set the new one directly