fixed logic error when running on multiple hosts