Issue #54: Fix SQL error