Improved fix for #20.