Bugfixed History clean scripts