fix incorrect variable usage for key registration
Fix tests for Python 3.3