improve log and debug info
merge with master