Fixed bugs with history