trying to fix race condition