fixed database (to make history possible)
now writes to the history database