Bug fix for issue #681
Merge pull request #682 from linas/sql

Bug fix for issue #681