many fixes
update log parsing logic, add unit test for it.