improved detection and matching of remote rubies, fix #2452