Fix some dynamic scoping