Fix a very silly pattern matching bug and an equally silly scoping bug.