fix: scoping errors