Fix logging

fixes #17 and #19 

many thanks to @maciejgalkiewicz and @dwradcliffe