Fixed issue #597