small changes and sql