Fix a bug in fetching keys for roles.