Fix bugs in async code; implement async trim.