Fix issue #522