Bugfix for #50. I'm slowly starting to take a shine to this.