Fix bug in logging