fix wrong sql