remove race by using fstat instead