bug 1391: fixed syntax in sql statement