modify algorithm bugs and complete insert log