If race is set to random and role is set to something specific, the Qt interface sometimes hangs trying to determine an appropriate race/role. This patch that fixes the problem, and makes 'random' work more appropriately.