small spelling correction and some sql cleanup