Small fix on race condition