fix bug in ID generation