Scope of boolean not being passed