Fix some scoping