update logging, fix bug