added wait loop at client