Fix a scope leak which caused tests to fail. Fixes #20