fix asynchronous issue with WaitsFor