bug 1391: fix sql statement