Fix a NullPointer in createAFPChain

Ignore errors when trying to set the structure names
Fix ScopFactory bug

The current version was being returned sometimes,
even when an older version was requested.