Fix problems with history log using wrong IDs