Fixed left recursion detection