This is an initial fix for #45.
There is a lot of cleanup that needs to be done, but this was what was causing the problem.
This is totally hacky, and should never hit the mainline.