Fix logging
Fixes #1536