minor sql cleanup
sql fixes