better sql checking