Pitfalls of asynchronous code