add log, and fix minor issue