Handle log output more gracefully

Hi,

this pull request should fix issue #44.

Kind regards,
  René