Fix of sga.py for opaque keys and
test.py for the resulting test failures.