Log improvement, fixed minor bugs