You should add a "next if !%Ticket" if no ticket was found, don't you think?