     end
 
     @spec dump_crash_clock(t) :: t
-    defp dump_crash_clock(__MODULE__[crash_clock: crash_clock, crash_clock_filename: f] = state)  do
-      File.write(f, ITC.encode_binary(crash_clock))
+    defp dump_crash_clock(__MODULE__[crash_clock: crash_clock, crash_clock_file: f] = state)  do
+      :file.pwrite(f, 0, ITC.encode_binary(crash_clock))
+      :file.datasync(f)
       state
-    end
-
-    @spec read_crash_clock(t) :: ITC.t
-    defp read_crash_clock(__MODULE__[crash_clock_filename: f]) do
-      if File.exists?(f) do
-        File.read!(f) |> ITC.decode
-      else
-        ITC.seed
-      end
     end
 
     @spec memoize(Genomu.key, binary, t) :: t

  end

  defrecord State, root: false, parent: nil,
                   clock: nil, crash_clock: nil, crash_clock_filename: nil,
                   outstanding: [],
                   snapshot: nil, log: [],
                   children: nil do

    record_type root: atom | boolean, parent: nil | Genomu.gen_server_ref,
                clock: nil | ITC.t, crash_clock: nil | ITC.t,
                crash_clock_filename: String.t,
                outstanding: [ITC.t],
                snapshot: nil | :ets.tid, log: [Genomu.Transaction.entry],
                children: nil | :ets.tid

  def terminate(_, State[root: false]) do
    :folsom_metrics.notify({{Genomu.Metrics, Channels}, {:dec, 1}})
  end
  def terminate(_, State[crash_clock_file: f]) do
    File.close(f)
    :ok
  end

