do some sql fixes after checking the syntax