Fixing scope in flush_interval