Fix bug #140

I haven't actually tested this, but I'm confident that this should fix bug #140