fixed substring, nested event issue