Fixes path when writing to history