Fixed issue raised by unit test from PR #600 (with thanks to aterrel).