avoid potential race condition