Functions to deal with async race conditions