generate id if missing