Improve logging
Bug fix