fixed bogus sql statement