Possible fix to #543
Merge pull request #607 from duncanspumpkin/fix_543_p

Possible fix to #543