
The code that selects the candidate backend always returned the root master if the server bitmask contained the master bit. This should only be done if the master bit is the only bit in the bitmask and when there are other bits, the normal candidate selection code should be used. Also added a query to the expanded test case to make sure the connection actually works.