Added missing $GLOBALS['wp_rewrite']

Not setting $rules = $GLOBALS['wp_rewrite']->wp_rewrite_rules(); meant that the plugin flushed the rules every time the method ws called.