Fix role error handling code.