scope fix

need tests for it