bug fix: generate a new Id when Id is empty