Fixes for PR #90 (thx @xabbuh)