added code to wait child's signal.