Fixed issue #502