add log module, fix some bug