fix render race condition