Use introspection to find a suitable sort key for managed object class.
Fix premature autorelease.