Fixing segfault bug on traversing parsed Patterns