If I see correctly it takes the first 3 relays regardless if they are read or write. Depending on the case you want the first 3 read or 3 write relays. If the code is not differentiating it should at least pick the first 3 that are both read+write.
Do you agree?