added wait after release of locks