Fixed trace to not visit rules more than once.