fixed the scope issue