fixing sql syntax