remove some dead code, fix a bug in log