fixed bugs in logging