fix loading race condition