return err on Register instead of panic