WIP: remove potential for infinite loops with CAS and fix a few issues in async