Fixed a bug in logging