Improved error handling of GCJ registry, added helper method for auto-registration.