fixed async race condition