add log in logging + bug fix