Fixed bug with history