fix bug in logging