fix UnboundlocalError when a role could not be found