Fixes #47.

@sebmck Test cases also needed an update.