Better fix for #107

Building on the earlier tempory fix.