fix id generation of tickets that would cause creation of duplicates