fixing scope issue