Fix crash when adding a gem in entity init()