Fix emerald casting