Scope problem on sending flag