fix race condition
fix warning