Possible fix for #31.

Completely untested (it probably won't even compile!).