improved host swap logic