Fix race condition with render method