fixed some sql syntax errs