a bit smarter fix for #77