Some minor scope bugs