fixing bug in logging