Fixed scope issue

The reference to rule was outside the scope where defined.