fix for #217

tested ok. But would prefer an appraisal. Is there a more elegant solution?