Bugfix for #89

Should be a better fix than #91 but needs to be cross OS tested.