fixed wrong sql