fixed bug with awaittermination.