fixes scoping problem