Fix allocation issues when a role is set