add waitfor support