Fixes #324
As discussed in the above issue.