Improve logging
Improve logging
Fixes #950