corrected id generation