Fix wrong sql