Fixed bug in logging