Fix bug in scoping.