Fixed issue with id generation