handle repeat and remove history log automatically