improve detecting port_root in case it is linked in rvm/bin, fix #2037