fix race condition in hide