Avoid potential race conditions.