Bugfix identified by Julian Cain.
Merge pull request #1 from Fraser999/next

Bugfix identified by Julian Cain.