fix race condition in on_new