refactor
refactor, fix potential dead block
set write time line